<template>
<slot :controller="controller" :store="store" :model="model">
    <div :class="classNames">
        <slot name="container1Container" :controller="controller" :store="store" :model="model" >
        <AppStandardContainer 
            name="container1"
            v-show="store.layoutModelDetails?.container1?.visible"
            :isMultiContainer="false"
            :layoutModelDetails="store.layoutModelDetails">
            <template #form>
                <slot name="form" :controller="controller" :store="store" :model="model"  :actions="{ handleCtrlInit, handleCtrlAction, handleCtrlDestroy }">
                <AppCtrlPos name="form" :layoutModelDetails="store.layoutModelDetails">
                    <slot name="ThirdTest409Form" :controller="controller" :store="store" :model="model" :actions="{ handleCtrlInit, handleCtrlAction, handleCtrlDestroy }">
                        <ThirdTest409Form
                            
                            :actions="{
                                loadAction: 'Get',
                                loadDraftAction: 'GetDraft',
                                updateAction: 'Update',
                                createAction: 'Create',
                                removeAction: 'Remove',
                                wfSubmitAction: 'WFSubmit',
                                wfStartAction: 'WFStart',
                            }"
                            :openView="store.openView"
                            :newView="store.newView"
                            name="form"
                            v-bind="model.ctrlParams.Thirdform"
                            :context="store.context"
                            :viewParams="store.viewParams"
                            :closeView="store.closeView"
                            :pLoadingHelper="store.loadingHelper"
                            :pViewCtx="store.viewCtx"
                            @ctrl-init="(name:string, ability:any) => { handleCtrlInit(controller, name, ability) }"
                            @ctrl-action="(name:string, action:any, data:any) => { handleCtrlAction(controller, name, action, data) }"
                            @ctrl-destroy="(name:string, data:any) => { handleCtrlDestroy(controller, name, data) }"    />
                    </slot>
                    </AppCtrlPos>
                </slot>
            </template>
        </AppStandardContainer>
        </slot>
    </div>
</slot>
</template>
<script lang="ts" setup>
// 基于template/src/views/{{appModules}}/{{pages@DECUSTOMVIEW}}/{{spinalCase page.codeName}}-base.vue.hbs生成
import { AppCtrlPos, AppScrollContainer, AppSimpleFlexContainer, AppStandardContainer, AppTabPanel, AppTabPage } from '@components/layout-element/structure';

import ThirdTest409Form from '@widgets/third/test-409-form/test-409-form.vue';
import { useProps, useBasic, useAction, useController } from './third-usr-0409504128-custom-view-hook';
import { IEvent, CustomViewActionType, ICustomViewAbility, ICustomViewStore, IParam } from '@/core';

// 输入参数
const props = defineProps(useProps());

// 基础数据
const { 
    model,
    getClassNames, 
    useNavParamsBind,
	useEventBind,
    handleQuickSearch,
  	handleToolbarItemClick,
    handleComponentAction,
	handleCtrlAction,
	handleCtrlInit,
	handleCtrlDestroy
} = useBasic(props);

const emit = defineEmits<{
    (event: 'view-action', name: string, action: CustomViewActionType, data: IParam[]): void;
    (event: 'view-init', name: string, data: ICustomViewAbility): void;
    (event: 'view-mounted', name: string, data: IParam): void;
    (event: 'view-destroy', name: string, data: IParam): void;
}>();

const evt = useEventBind(emit);
const classNames = computed(() => {
  	return getClassNames(props);
});

// 初始化控制器
const controller = useController(props, evt);

useNavParamsBind(controller, props);

const store: ICustomViewStore = controller.getStore();

onMounted(() => {
    controller.viewMounted();
})

onUnmounted(() => {
    controller.viewDestroy();
})
</script>
